<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>早安暖心一句话</title>
    <!-- 引入Tailwind CSS -->
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- 引入Font Awesome -->
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    
    <!-- 配置Tailwind自定义颜色和字体 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#FF9F45', // 温暖的橙色作为主色调
                        secondary: '#6C5CE7', // 柔和的紫色作为辅助色
                        neutral: '#F8F9FA', // 浅色背景
                        dark: '#2D3436' // 深色文本
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                        serif: ['Georgia', 'serif']
                    }
                }
            }
        }
    </script>
    
    <!-- 自定义工具类 -->
    <style type="text/tailwindcss">
        @layer utilities {
            .text-shadow {
                text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
            }
            .quote-box {
                backdrop-filter: blur(10px);
            }
        }
    </style>
    
    <style>
        /* 全局动画定义 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .animate-fade-in {
            animation: fadeIn 1s ease-out forwards;
        }
        
        .sun-animation {
            animation: rotate 20s linear infinite;
        }
        
        @keyframes rotate {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        
        /* 平滑滚动 */
        html {
            scroll-behavior: smooth;
        }
    </style>
</head>
<body class="bg-gradient-to-br from-amber-50 to-blue-50 min-h-screen font-sans text-dark">
    <!-- 顶部导航栏 -->
    <header class="sticky top-0 z-50 bg-white/80 backdrop-blur-md shadow-sm transition-all duration-300">
        <div class="container mx-auto px-4 py-4 flex justify-between items-center">
            <div class="flex items-center space-x-2">
                <i class="fa fa-sun-o text-primary text-2xl sun-animation"></i>
                <h1 class="text-xl md:text-2xl font-bold bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent">早安暖心一句话</h1>
            </div>
            <nav>
                <ul class="flex space-x-6">
                    <li><a href="#today" class="hover:text-primary transition-colors duration-300 flex items-center"><i class="fa fa-home mr-1"></i> 今日</a></li>
                    <li><a href="#history" class="hover:text-primary transition-colors duration-300 flex items-center"><i class="fa fa-history mr-1"></i> 历史</a></li>
                    <li><a href="#about" class="hover:text-primary transition-colors duration-300 flex items-center"><i class="fa fa-info-circle mr-1"></i> 关于</a></li>
                </ul>
            </nav>
        </div>
    </header>

    <main class="container mx-auto px-4 py-8">
        <!-- 今日问候语部分 -->
        <section id="today" class="py-12 md:py-20">
            <div class="max-w-3xl mx-auto text-center">
                <div class="text-primary mb-4 text-lg md:text-xl font-medium">
                    <span id="current-date"></span> · 早安
                </div>
                
                <div class="quote-box bg-white/60 rounded-2xl p-8 md:p-12 shadow-lg mb-8 transform transition-all duration-500 hover:shadow-xl hover:-translate-y-1">
                    <i class="fa fa-quote-left text-primary/40 text-4xl absolute -top-4 left-4"></i>
                    <p id="today-quote" class="text-lg md:text-2xl font-serif leading-relaxed mb-6 relative z-10">
                        每一个清晨都是生命的重启，早安！愿你在新的一天里，心怀希望，遇见奇迹，品味生活的每一份甜蜜。
                    </p>
                    <i class="fa fa-quote-right text-primary/40 text-4xl absolute -bottom-4 right-4"></i>
                </div>
                
                <div class="flex justify-center space-x-4">
                    <button id="refresh-btn" class="bg-primary/10 hover:bg-primary/20 text-primary px-4 py-2 rounded-full flex items-center transition-all duration-300">
                        <i class="fa fa-refresh mr-2"></i>换一句
                    </button>
                    <button id="share-btn" class="bg-secondary/10 hover:bg-secondary/20 text-secondary px-4 py-2 rounded-full flex items-center transition-all duration-300">
                        <i class="fa fa-share-alt mr-2"></i>分享
                    </button>
                </div>
            </div>
        </section>
        
        <!-- 历史记录部分 -->
        <section id="history" class="py-12 bg-white/40 rounded-3xl p-6 md:p-10 mb-16">
            <h2 class="text-2xl md:text-3xl font-bold text-center mb-10 flex items-center justify-center">
                <i class="fa fa-history text-primary mr-3"></i>
                历史问候
            </h2>
            
            <div id="history-container" class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <!-- 历史记录将通过JavaScript动态生成 -->
            </div>
            
            <div class="text-center mt-10">
                <button id="load-more" class="border-2 border-primary text-primary hover:bg-primary hover:text-white px-6 py-3 rounded-full transition-all duration-300">
                    加载更多
                </button>
            </div>
        </section>
        
        <!-- 关于部分 -->
        <section id="about" class="py-12 text-center max-w-2xl mx-auto">
            <h2 class="text-2xl md:text-3xl font-bold mb-6 flex items-center justify-center">
                <i class="fa fa-info-circle text-primary mr-3"></i>
                关于我们
            </h2>
            
            <div class="bg-white/60 rounded-2xl p-8 shadow-md text-left">
                <p class="mb-4">每日更新一句涵盖生活感悟、激励奋进、情感关怀等多元主题的早安问候语。</p>
                
                <p class="mb-4">这些话语皆为原创，或来源于经典文学作品、名人名言的摘录与改编，旨在用积极乐观的语句，在一天伊始为用户注入活力，给予心灵慰藉。</p>
                
                <div class="mt-8 pt-6 border-t border-gray-200">
                    <h3 class="font-bold mb-3">联系我们</h3>
                    <p class="flex items-center mb-2">
                        <i class="fa fa-envelope text-primary mr-3 w-5 text-center"></i>
                        <a href="mailto:hello@morningquote.com" class="hover:text-primary transition-colors">hello@morningquote.com</a>
                    </p>
                    <p class="flex items-center">
                        <i class="fa fa-weixin text-primary mr-3 w-5 text-center"></i>
                        微信公众号：早安暖心一句话
                    </p>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer class="bg-dark text-white py-8">
        <div class="container mx-auto px-4 text-center">
            <div class="mb-4">
                <a href="#" class="text-white/70 hover:text-primary mx-3 transition-colors">
                    <i class="fa fa-weibo text-xl"></i>
                </a>
                <a href="#" class="text-white/70 hover:text-primary mx-3 transition-colors">
                    <i class="fa fa-weixin text-xl"></i>
                </a>
                <a href="#" class="text-white/70 hover:text-primary mx-3 transition-colors">
                    <i class="fa fa-instagram text-xl"></i>
                </a>
            </div>
            
            <p class="text-white/60 text-sm mb-2">© 2025 早安暖心一句话 - 用温暖开启每一天</p>
            <p class="text-white/40 text-xs">
                <a href="https://beian.miit.gov.cn/" target="_blank" class="hover:text-white/70 transition-colors">
                    粤ICP备2025447472号-2
                </a>
            </p>
        </div>
    </footer>

    <!-- 分享弹窗 -->
    <div id="share-modal" class="fixed inset-0 bg-black/50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-2xl p-6 max-w-md w-full mx-4 animate-fade-in">
            <div class="flex justify-between items-center mb-4">
                <h3 class="text-xl font-bold">分享今日早安</h3>
                <button id="close-share" class="text-gray-500 hover:text-gray-800">
                    <i class="fa fa-times text-xl"></i>
                </button>
            </div>
            
            <div class="py-4 border-y">
                <p id="share-content" class="text-center text-lg font-serif mb-6">
                    每一个清晨都是生命的重启，早安！
                </p>
                
                <div class="grid grid-cols-4 gap-4 text-center">
                    <a href="#" class="flex flex-col items-center p-3 hover:bg-gray-100 rounded-lg transition-colors">
                        <i class="fa fa-weixin text-green-600 text-2xl mb-2"></i>
                        <span class="text-sm">微信</span>
                    </a>
                    <a href="#" class="flex flex-col items-center p-3 hover:bg-gray-100 rounded-lg transition-colors">
                        <i class="fa fa-weibo text-red-500 text-2xl mb-2"></i>
                        <span class="text-sm">微博</span>
                    </a>
                    <a href="#" class="flex flex-col items-center p-3 hover:bg-gray-100 rounded-lg transition-colors">
                        <i class="fa fa-qq text-blue-500 text-2xl mb-2"></i>
                        <span class="text-sm">QQ</span>
                    </a>
                    <a href="#" class="flex flex-col items-center p-3 hover:bg-gray-100 rounded-lg transition-colors">
                        <i class="fa fa-link text-gray-500 text-2xl mb-2"></i>
                        <span class="text-sm">复制链接</span>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 问候语句库
        const quotes = [
            "每一个清晨都是生命的重启，早安！愿你在新的一天里，心怀希望，遇见奇迹，品味生活的每一份甜蜜。",
            "早安，愿清晨的曙光带给你无限的温暖与憧憬，开启你绚烂的一天，让快乐与你并肩。",
            "新的一天，新的开始。放下昨日的烦恼，拥抱今日的阳光。早安，世界因你而精彩。",
            "清晨的第一缕阳光，是大自然的问候；此刻的一句早安，是我们对你的祝福。愿你今天一切顺利。",
            "生活就像一杯清水，你每天都喝，不要羡慕别人喝的饮料有各种颜色，其实未必有你的清水解渴。早安！",
            "每天给自己一个希望，不为明天烦恼，不为昨天叹息，只为今天更美好。早安！",
            "晨光熹微，新的一天悄然开启。愿你的世界，永远充满阳光；愿你的心中，永远满怀期待。早安！",
            "清晨的风，带来了清新的空气；清晨的你，带来了全新的希望。早安，愿你今天有个好心情。",
            "每一个日出，都是一个新的希望；每一个清晨，都意味着一个新的开始。早安，勇敢去追逐你的梦想吧！",
            "当第一缕阳光洒向大地，我想对你说：早安！愿你今天的笑容，如同这阳光般灿烂。",
            "早晨，是一天中最纯净的时刻。放下所有负担，让心灵回归宁静。早安，美好的一天开始了。",
            "不要辜负每一个清晨，因为它承载着新的希望和可能。早安，努力成为更好的自己。",
            "清晨的问候，如同温暖的拥抱，给你力量开始新的一天。早安，愿你被世界温柔以待。",
            "太阳每天都是新的，生活也应该如此。早安，愿你今天有新的收获和成长。",
            "用微笑迎接清晨，用快乐开始一天。早安，世界和你都很美好。",
            "每一个清晨，都是一次重生的机会。忘记过去的遗憾，珍惜当下的时光。早安！",
            "清晨的鸟儿在歌唱，仿佛在对你说：早安！新的一天，充满了无限可能。",
            "让清晨的阳光照亮你的心房，让温暖的问候陪伴你的身旁。早安，愿你今天一切安好。",
            "早晨的第一杯茶，第一缕阳光，第一句问候，都为你而准备。早安，我的朋友。",
            "生活就像清晨的露珠，晶莹剔透，充满生机。珍惜每一个瞬间，早安！"
        ];

        // 生成历史记录数据
        function generateHistory() {
            const history = [];
            const today = new Date();
            
            for (let i = 1; i <= 15; i++) {
                const date = new Date(today);
                date.setDate(today.getDate() - i);
                
                // 随机选择一句问候语
                const randomIndex = Math.floor(Math.random() * quotes.length);
                const quote = quotes[randomIndex];
                
                history.push({
                    date: formatDate(date),
                    quote: quote
                });
            }
            
            return history;
        }

        // 格式化日期为"YYYY年MM月DD日 星期X"
        function formatDate(date) {
            const year = date.getFullYear();
            const month = date.getMonth() + 1;
            const day = date.getDate();
            const weekdays = ['日', '一', '二', '三', '四', '五', '六'];
            const weekday = weekdays[date.getDay()];
            
            return `${year}年${month}月${day}日 星期${weekday}`;
        }

        // 显示当前日期
        function displayCurrentDate() {
            const today = new Date();
            document.getElementById('current-date').textContent = formatDate(today);
        }

        // 显示随机问候语
        function displayRandomQuote() {
            const quoteElement = document.getElementById('today-quote');
            const randomIndex = Math.floor(Math.random() * quotes.length);
            
            // 添加淡出效果
            quoteElement.style.opacity = '0';
            quoteElement.style.transform = 'translateY(10px)';
            
            setTimeout(() => {
                quoteElement.textContent = quotes[randomIndex];
                // 添加淡入效果
                quoteElement.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
                quoteElement.style.opacity = '1';
                quoteElement.style.transform = 'translateY(0)';
            }, 300);
        }

        // 渲染历史记录
        function renderHistory(history, containerId, limit = 6) {
            const container = document.getElementById(containerId);
            container.innerHTML = '';
            
            // 限制显示数量
            const displayItems = history.slice(0, limit);
            
            displayItems.forEach((item, index) => {
                // 添加延迟动画效果
                setTimeout(() => {
                    const historyItem = document.createElement('div');
                    historyItem.className = 'bg-white/80 rounded-xl p-5 shadow-sm hover:shadow-md transition-all duration-300';
                    
                    historyItem.innerHTML = `
                        <div class="text-gray-500 text-sm mb-2">${item.date}</div>
                        <div class="text-gray-700 italic">${item.quote}</div>
                    `;
                    
                    container.appendChild(historyItem);
                }, index * 100);
            });
        }

        // 初始化页面
        function init() {
            // 显示当前日期
            displayCurrentDate();
            
            // 显示随机问候语
            displayRandomQuote();
            
            // 生成并渲染历史记录
            const history = generateHistory();
            renderHistory(history, 'history-container');
            
            // 绑定刷新按钮事件
            document.getElementById('refresh-btn').addEventListener('click', displayRandomQuote);
            
            // 绑定分享按钮事件
            const shareBtn = document.getElementById('share-btn');
            const shareModal = document.getElementById('share-modal');
            const closeShare = document.getElementById('close-share');
            
            shareBtn.addEventListener('click', () => {
                // 更新分享内容
                document.getElementById('share-content').textContent = document.getElementById('today-quote').textContent;
                shareModal.classList.remove('hidden');
                document.body.style.overflow = 'hidden'; // 防止背景滚动
            });
            
            closeShare.addEventListener('click', () => {
                shareModal.classList.add('hidden');
                document.body.style.overflow = 'auto'; // 恢复滚动
            });
            
            // 点击模态框外部关闭
            shareModal.addEventListener('click', (e) => {
                if (e.target === shareModal) {
                    shareModal.classList.add('hidden');
                    document.body.style.overflow = 'auto';
                }
            });
            
            // 加载更多历史记录
            let currentLimit = 6;
            document.getElementById('load-more').addEventListener('click', () => {
                currentLimit += 6;
                renderHistory(history, 'history-container', currentLimit);
                
                // 如果已经显示所有记录，隐藏加载更多按钮
                if (currentLimit >= history.length) {
                    document.getElementById('load-more').classList.add('hidden');
                }
            });
            
            // 导航栏滚动效果
            window.addEventListener('scroll', () => {
                const header = document.querySelector('header');
                if (window.scrollY > 50) {
                    header.classList.add('py-2');
                    header.classList.remove('py-4');
                } else {
                    header.classList.add('py-4');
                    header.classList.remove('py-2');
                }
            });
        }

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', init);
    </script>
</body>
</html>
